package com.game;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

import sun.org.mozilla.javascript.internal.WrapFactory;

import com.leetcode.OutTxt;

public class ClientThread implements Runnable
{
	private Socket s;
	private BufferedReader br = null;
	
	public ClientThread(Socket so) throws IOException
	{
		this.s = so;
		br =new BufferedReader(new InputStreamReader(s.getInputStream()));  
	}
	
	@Override
	public void run()
	{
		try
		{
			//OutTxt.Write(Thread.currentThread().getName());
			if (br.readLine().equals(""))
			{
				OutTxt.Write(Thread.currentThread().getName());
				return;
			}
			
			String content = null;
			while ((content = br.readLine()) != null)
			{
				OutTxt.Write("ss");
				System.out.println(content);
				
			}
		}
		catch (Exception e)
		{
			OutTxt.Write(e.getMessage());
		}
		
	}
}
